﻿<%@ Page Title="" Language="C#" MasterPageFile="~/FYPSite.Master" AutoEventWireup="true"
    CodeBehind="WebFormMonth.aspx.cs" Inherits="JsonServer.WebFormMonth" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server" style="background-color: #00FFFF; width: 766px; height: 651px;">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanelOfMonthPage" runat="server">
            <ContentTemplate>
                <asp:ObjectDataSource ID="MonthlyDataSourceFromTable" runat="server" DeleteMethod="Delete"
                    InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByMonth"
                    TypeName="JsonServer.FYPDataSetTableAdapters.FYPPowerTableTableAdapter" UpdateMethod="Update">
                    <DeleteParameters>
                        <asp:Parameter Name="Original_Id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Power" Type="String" />
                        <asp:Parameter Name="CreateDate" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="TextBoxOfMonthPageYear" Name="YEAR" PropertyName="Text"
                            Type="String" />
                        <asp:ControlParameter ControlID="TextBoxOfMonthPageMonth" Name="MONTH" PropertyName="Text"
                            Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Power" Type="String" />
                        <asp:Parameter Name="CreateDate" Type="String" />
                        <asp:Parameter Name="Original_Id" Type="Int32" />
                    </UpdateParameters>
                </asp:ObjectDataSource>
                <br />
                <br />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Year:
                <asp:TextBox ID="TextBoxOfMonthPageYear" runat="server" MaxLength="4" Width="245px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxOfMonthPageYear"
                    ErrorMessage="Please input year value">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBoxOfMonthPageYear"
                    ErrorMessage="Invalid year value" ValidationExpression="\d{4}$">*</asp:RegularExpressionValidator>
                <br />
                <br />
                <br />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Month:
                <asp:TextBox ID="TextBoxOfMonthPageMonth" runat="server" MaxLength="2" Width="245px"></asp:TextBox>
                <asp:Button ID="ButtonCalculateMonthPower" runat="server" OnClick="ButtonCalculateMonthPower_Click"
                    Text="Calculate" Style="z-index: 1; left: 743px; top: 151px; position: absolute;
                    width: 235px; height: 50px;" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBoxOfMonthPageMonth"
                    ErrorMessage="Please input month value">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TextBoxOfMonthPageMonth"
                    ErrorMessage="Invalid month value" ValidationExpression="\d{2}$">*</asp:RegularExpressionValidator>
                <br />
                <br />
                <br />
                <asp:Label ID="LabelMonthPower" runat="server" Style="z-index: 1; left: 637px; top: 238px;
                    position: absolute; height: 19px;"></asp:Label>
                <br />
                <asp:ValidationSummary ID="ValidationSummary" runat="server" ForeColor="Red" Style="z-index: 1;
                    left: 644px; top: 278px; position: absolute; height: 32px; width: 297px" />
                <br />
                <asp:Chart ID="Chart1" runat="server" DataSourceID="MonthlyDataSourceFromTable" Style="z-index: 1;
                    left: 373px; top: 418px; position: absolute;" Height="294px" Width="289px">
                    <Series>
                        <asp:Series ChartType="Spline" Name="Series1" XValueMember="CreateDate" YValueMembers="Power">
                        </asp:Series>
                    </Series>
                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea1">
                        </asp:ChartArea>
                    </ChartAreas>
                </asp:Chart>
                <br />
                <br />
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                    AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="MonthlyDataSourceFromTable"
                    CellPadding="4" ForeColor="#333333" GridLines="None" Width="250px" Style="z-index: 1;
                    left: 690px; top: 422px; position: absolute; height: 295px; width: 250px">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" ReadOnly="True" />
                        <asp:BoundField DataField="Power" HeaderText="Power" SortExpression="Power" />
                        <asp:BoundField DataField="CreateDate" HeaderText="CreateDate" SortExpression="CreateDate" />
                    </Columns>
                    <EditRowStyle BackColor="#2461BF" />
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#EFF3FB" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                    <SortedDescendingHeaderStyle BackColor="#4870BE" />
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
    </div>
</asp:Content>
